package
{
	import logic.med.scene.SceneA;
	
	import common.core.GEngine;
	import common.manager.GScene;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	import logic.med.scene.PreScene;

	[SWF(width=800,height=500)]
	public class GDemoMain extends Sprite
	{
		public function GDemoMain()
		{
			if(this.stage)
			{
				init();
			}
			else
			{
			   this.addEventListener(Event.ADDED_TO_STAGE,addToStage);	
			}
		}
		
		private function init() : void
		{
			GEngine.start(800,500,this,startGame);
		}
		
		private function startGame() : void
		{
			GScene.addScene(PreScene.NAME,new PreScene);
			GScene.addScene(SceneA.NAME,new SceneA);
			
			GScene.openScene(PreScene.NAME);
		}
		
		private function addToStage(evt : Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, addToStage);
			
			init();
		}
	}
}